import React, { useEffect, useState } from 'react';
import { Button,Drawer } from "antd";
function Theme() {
    const [theme,setTheme]=useState(()=>{
        const save=localStorage.getItem('theme')
        return save?'light':'dark'
    })
    useEffect(()=>{
        // document.body.classList('data-theme','light')
        localStorage.setItem('theme',theme?'dark':'light')
    },[theme])
    const qie=()=>{
        setOpen(true);
    }
    const [open, setOpen] = useState(false);

  const showDrawer = () => {
    setOpen(true);
  };

  const onClose = () => {
    setOpen(false);
  };
    return (
        <div>
            <Button onClick={qie} >切换</Button>
            <Drawer
        title="Basic Drawer"
        closable={{ 'aria-label': 'Close Button' }}
        onClose={onClose}
        open={open}
      >
        <Button>切换</Button>
        
      </Drawer>
        </div>
    );
}

export default Theme;